@PACKAGE_INIT@

if (WIN32 AND NOT MSVC)
    message(FATAL_ERROR "Brisk requires MSVC or an MSVC-compatible compiler (e.g., clang-cl) on Windows")
endif ()

include(${CMAKE_CURRENT_LIST_DIR}/BriskTargets.cmake)

include(${CMAKE_CURRENT_LIST_DIR}/BriskConfigVersion.cmake)

add_library(brisk-core ALIAS Brisk::Core)
add_library(brisk-graphics ALIAS Brisk::Graphics)
add_library(brisk-window ALIAS Brisk::Window)
add_library(brisk-gui ALIAS Brisk::Gui)
add_library(brisk-widgets ALIAS Brisk::Widgets)
add_library(brisk-network ALIAS Brisk::Network)
add_library(brisk-executable ALIAS Brisk::Executable)
add_library(brisk-i18n-icu ALIAS Brisk::I18n-Icu)

if (TARGET Brisk::brisk-renderer-webgpu)
    add_library(brisk-renderer-webgpu ALIAS Brisk::brisk-renderer-webgpu)
endif ()
if (TARGET Brisk::brisk-renderer-d3d11)
    add_library(brisk-renderer-d3d11 ALIAS Brisk::brisk-renderer-d3d11)
endif ()

get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_BRISK_DIST_DIR "${_DIR}/../../.." ABSOLUTE)
get_filename_component(_BRISK_INCLUDE_DIR "${_BRISK_DIST_DIR}/include" ABSOLUTE)
set(BRISK_RESOURCES_DIR ${_BRISK_DIST_DIR}/resources)

file(GLOB SCRIPT_FILES "${_DIR}/scripts/*.cmake")
foreach (f ${SCRIPT_FILES})
    include(${f})
endforeach ()

include(CMakeFindDependencyMacro)

set(BRISK_BROTLI @BRISK_BROTLI@)
set(BRISK_WEBGPU @BRISK_WEBGPU@)
set(BRISK_D3D11 @BRISK_D3D11@)

if (BRISK_ICU)
    target_link_libraries(Brisk::Graphics INTERFACE Brisk::I18n-Icu)
else ()
    target_link_libraries(Brisk::Graphics INTERFACE Brisk::I18n)
endif ()

set(_DEP_PUBLIC INTERFACE)
set(_DEP_PRIVATE INTERFACE)
set(_FIND_PACKAGE find_dependency)

set(_EXPORT_MODE TRUE)

include(${_DIR}/deps/Core.cmake)
include(${_DIR}/deps/Graphics.cmake)
include(${_DIR}/deps/Network.cmake)
include(${_DIR}/deps/Window.cmake)
include(${_DIR}/deps/Gui.cmake)

unset(_DEP_PUBLIC)
unset(_DEP_PRIVATE)
unset(_FIND_PACKAGE)
